package com.assistant.core.modules.sys;

import com.assistant.core.modules.sys.domain.user.User;
import lombok.experimental.UtilityClass;

@UtilityClass
public class BusinessContext {

    private static final ThreadLocal<User> operatorThreadLocal = new ThreadLocal<>();

    public static void setOperator(User operator) {
        operatorThreadLocal.set(operator);
    }

    public static User getOperator() {
        return operatorThreadLocal.get();
    }

    public static void remove() {
        operatorThreadLocal.remove();
    }
}
